SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.[DISC_DefaultStampConfigCount]
	@DistributorID varchar(50),
	@DRMType varchar(20)
AS
BEGIN
	IF (@DRMType IS NULL)
		SELECT count(*) FROM (
			SELECT [ID] FROM [DISC_DefaultStampConfig] WHERE [distID] = @DistributorID
			UNION ALL
			SELECT [ID] FROM [DISC_DefaultDRMStampConfig] WHERE [distID] = @DistributorID
		) AS [DefaultStampConfig]
	ELSE IF (@DRMType = 'Stamp')
		SELECT count([ID]) FROM [DISC_DefaultStampConfig] WHERE [distID] = @DistributorID
	ELSE
		SELECT count([ID]) FROM [DISC_DefaultDRMStampConfig] WHERE [distID] = @DistributorID AND [DRMType] = @DRMType
END
GO
